<?php
declare (strict_types = 1);

namespace app\controller;

use League\HTMLToMarkdown\HtmlConverter;
use think\facade\Cache;
use think\facade\View;
use think\Request;

class Parsedown extends Common
{

    public function __construct()
    {
        parent::__construct();
    }
    /**
     * markdown转html
     *
     * @return \think\Response
     */
    public function index()
    {
        $res = \app\common\model\Article::find(4)->toArray();
        $Parsedown = new \Parsedown();

        echo $Parsedown->text('Hello _Parsedown_!'); # prints: <p>Hello <em>Parsedown</em>!</p>

        p(2222222222222222);
        echo $Parsedown->text($res["info"]);
    }

    //html转，Markdown
    public function test()
    {
        $res = \app\common\model\Article::find(100)->toArray();

        $converter = new HtmlConverter();

        $html = $res["info"];
        $markdown = $converter->convert($html);
        echo $markdown;
    }

}
